import axios from "axios";

// 列表接口
export function fetchDepartmentList(params) {
  return axios({
    url: "http://localhost:3001/data",
    method: "GET",
    params,
  });
}
// 删除接口
export function delDepartmentList(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "DELETE",
    params: id,
  });
}
// 搜索接口
export function getmentList(par) {
  return axios({
    url: `http://localhost:3001/data/?name=${par}`,
    method: "get",
  });
}
// 详情接口
export function getDepartmentList(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: "get",
  });
}

//新增按钮
export function postDepartmentList(data) {
  return axios({
    url: "http://localhost:3001/data",
    method: "post",
    data,
  });
}
// 编辑接口  新增
export function updatePermission(data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: "PUT",
    data,
  });
}
